<?php

namespace App\Resource;

use App\Model\Collect;
use Hyperf\Resource\Json\ResourceCollection;

class CollectCollection extends ResourceCollection
{
    /**
     * Transform the resource collection into an array.
     *
     * @return array
     */
    public function toArray(): array
    {
        return parent::toArray();
    }

    public function toListApi()
    {
        $data = [];
        /** @var Collect $v */
        foreach ($this as $v) {
            $data[] = $v->toApi();
        }

        return $data;
    }
}
